#ifndef INODE_H_
#define INODE_H_

#include <vector>
#include <string>
#include "../physicalDisk/PhysicalDisk.h"

using namespace std;

class Inode {

private:
	int number;
	int offset;
	//f for file, d for directory, s for soft-link
	char type;
	int numOfHardLinks;
	int fileSize;
	//contain numbers of the direct blocks
	int directBlocks[10];
	int indirectBlockOffset;
	int numOfAllocatedBlocks;
	int maxBlocksCapacity;
	//contains numbers of the extra blocks
	vector<int> indirectBlock;

public:
	Inode (int inodeNum, int inodeOffset, int inodeIndirectBlockOffset,
			int blockSize);
	Inode (int inodeNum, int inodeOffset, char inodeType, int inodeNumOfHardLinks,
			int inodeFileSize, vector<int> inodeBlocks, int inodeIndirectBlockOffset,
			int blockSize);

	virtual ~Inode();
	int getNumber();
	int getIndirectBlockNum();
	char getType();
	void setType(char inodeType);
	void incNumOfHardLinks();
	void decNumOfHardLinks();
	int getNumOfHardLinks();
	int getDataBlock (int i);
	int setDataBlock (int i, int dblock);
	int getFileSize();
	int getOffset();
	void decreaseBlocksCounter();
	bool hasAllocatedBlocks();
	void setFileSize (int i);
	void writeToPhysicalDisk();
};

#endif /* INODE_H_ */
